package com.ruoyi.web.controller.config;

import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SaTokenConfigure implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        // 注册 Sa-Token 拦截器
//        registry.addInterceptor(new SaInterceptor(handler -> {
//            // 对所有请求进行登录校验
//            SaRouter.match("/**")
//                .notMatch("/admin/user/login", "/admin/user/captcha","/file/**","/system/videoData/saveTelemetryData") // 排除登录、注册、验证码
//                .check(r -> StpUtil.checkLogin());
//        })).addPathPatterns("/**");
    }
}